<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- <div class="test"></div> -->

    <div class="container">
        <div>宽高比1:1</div>
        <div>宽高比2:1</div>
        <div>宽高比3:1</div>
    </div>
</body>

<style>
    /* 通过 aspect-ratio 属性，即可以控制元素的整体宽高 */
    /* .test {
        margin-bottom: 20px;
        background: yellowgreen;
        aspect-ratio: 1/2;
        width: 100px;
    } */

    .container {
        display: flex;
        width: 30vw;
        padding: 20px;
        gap: 20px;
        background-color: green;
    }

    .container>div {
        flex-grow: 1;
        background: deeppink;
    }

    .container>div:nth-child(1) {
        aspect-ratio: 1/1;
    }

    .container>div:nth-child(2) {
        aspect-ratio: 2/1;
    }

    .container>div:nth-child(3) {
        aspect-ratio: 3/1;
    }
</style>

</html>